package com.tbit.uqbike.push.util;

import com.tbit.uqbike.push.constant.ThreadType;
import com.tbit.uqbike.push.service.ThreadService;

/**
 * @author chenmengran
 * @Description: 线程操作
 * @date 2019\6\17 00179:18
 */
public class ThreadUtils implements Runnable {

    private Integer threadType;
    private ThreadService threadService;

    public ThreadUtils(ThreadService threadService, Integer threadType) {
        this.threadType = threadType;
        this.threadService = threadService;
    }

    @Override
    public void run() {
        if (threadType == ThreadType.GEO_INSIDE) {
            threadService.insidePush();
        }
        if (threadType == ThreadType.GEO_WARN) {
            threadService.warn();
        }
        if (threadType == ThreadType.GEO_OUTSIDE) {
            threadService.outsidePush();
        }
        if (threadType == ThreadType.GEO_OUT_FORBIDDEN) {
            threadService.outForbidden();
        }
        if (threadType == ThreadType.GEO_INSIDE_FORBIDDEN) {
            threadService.insideForbidden();
        }
        if (threadType == ThreadType.GEO_NEAR_FORBIDDEN) {
            threadService.warn();
        }
    }
}
